home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / nos042_s / usock.h < prev    next >
C/C++ Source or Header  |  1994-09-16  |  3KB  |  116 lines

  1. /****************************************************************************
  2. *    $Id: usock.h 1.3 93/07/16 11:52:12 ROOT_DOS Exp $
  3. *    13 Jul 93    1.2        GT    Conditional LZW stuff.                            *
  4. ****************************************************************************/
  5. #ifndef    _USOCK_H
  6. #define    _USOCK_H
  7.  
  8. #ifndef    _MBUF_H
  9. #include "mbuf.h"
  10. #endif
  11.  
  12. #ifndef    _LZW_H
  13. #include "lzw.h"
  14. #endif
  15.  
  16. #ifndef _PROC_H
  17. #include "proc.h"
  18. #endif
  19.  
  20. #ifndef _TCP_H
  21. #include "tcp.h"
  22. #endif
  23.  
  24. #ifndef _UDP_H
  25. #include "udp.h"
  26. #endif
  27.  
  28. #ifndef _IP_H
  29. #include "ip.h"
  30. #endif
  31.  
  32. #ifndef _NETROM_H
  33. #include "netrom.h"
  34. #endif
  35.  
  36. #ifndef _SOCKADDR_H
  37. #include "sockaddr.h"
  38. #endif
  39.  
  40. struct loc {
  41.     struct usock *peer;
  42.     struct mbuf *q;
  43.     int hiwat;        /* Flow control point */
  44.     int flags;
  45. #define    LOC_SHUTDOWN    1
  46. };
  47. #define    NULLLOC    (struct loc *)0
  48. #define    LOCDFLOW    5    /* dgram socket flow-control point, packets */
  49. #define    LOCSFLOW    2048    /* stream socket flow control point, bytes */
  50. #define    SOBUF        1024    /* Size of buffer for usputc()/usprintf() */
  51. #define    SOCKBASE    128    /* Start of socket indexes */
  52.  
  53. union sp {
  54.         struct sockaddr *sa;
  55.         struct sockaddr_in *in;
  56.         struct sockaddr_ax *ax;
  57.         struct sockaddr_nr *nr;
  58.         char *p;
  59. };
  60.  
  61. union cb {
  62.     struct tcb *tcb;
  63.     struct ax25_cb *ax25;
  64.     struct udp_cb *udp;
  65.     struct raw_ip *rip;
  66.     struct raw_nr *rnr;
  67.     struct nr4cb *nr4;
  68.     struct loc *local;
  69.     char *p;
  70. };
  71.  
  72. /* User sockets */
  73. struct usock {
  74.     struct proc *owner;
  75.     int refcnt;
  76.     char noblock;
  77.     char type;
  78. #define    NOTUSED            0
  79. #define    TYPE_TCP        1
  80. #define    TYPE_UDP        2
  81. #define    TYPE_AX25I        3
  82. #define    TYPE_AX25UI        4
  83. #define TYPE_RAW        5
  84. #define TYPE_NETROML3        6
  85. #define TYPE_NETROML4        7
  86. #define    TYPE_LOCAL_STREAM    8
  87. #define    TYPE_LOCAL_DGRAM    9
  88.     int rdysock;
  89.     union cb cb;
  90.     char *name;
  91.     int namelen;
  92.     char *peername;
  93.     int peernamelen;
  94.     char errcodes[4];    /* Protocol-specific error codes */
  95.     struct mbuf *obuf;    /* Output buffer */
  96.     struct mbuf *ibuf;    /* Input buffer */
  97.     char eol[3];        /* Text mode end-of-line sequence, if any */
  98.     int flag;        /* Mode flags, defined in socket.h */
  99.     int flush;        /* Character to trigger flush, if any */
  100. #if    LZW
  101.     struct lzw *zout;    /* Pointer to compression structure */
  102.     struct lzw *zin;
  103. #endif
  104. };
  105. #define    NULLUSOCK    ((struct usock *)0)
  106.  
  107. extern char Badsocket[];
  108. extern char *Socktypes[];
  109. extern struct usock *Usock;
  110. extern int Nusock;
  111.  
  112. struct usock *itop __ARGS((int s));
  113. void st_garbage __ARGS((int red));
  114.  
  115. #endif /* _USOCK_H */
  116.